package net.awpspace.mp3player.entity;

import java.util.Vector;

import javax.microedition.lcdui.List;

public class FavoriteList {
	private static FavoriteList self;

	private static Vector f_list;

	public FavoriteList() {
		f_list = new Vector();
	}

	public static FavoriteList getInstance() {
		if (self == null)
			self = new FavoriteList();
		return self;
	}

	public static void addFavorite(Mp3File file) {
		f_list.addElement(file);
	}

	public static void removeFile(Mp3File file) {
		for (int i = 0; i < f_list.size(); i++) {
			if (file.Equals((Mp3File) f_list.elementAt(i)))
				f_list.removeElementAt(i);
		}
	}

	public static Mp3File getFavoriteFile(int index) {
		return (Mp3File) f_list.elementAt(index);
	}

	public static Vector getListFavorite(){
		return f_list;
	}
	public static boolean checkExis(Mp3File file) {
		for (int i = 0; i < f_list.size(); i++) {
			if (file.Equals((Mp3File) f_list.elementAt(i)))
				return true;
		}
		return false;
	}

}
